function Get-StatSharePointVersion
{
    <# 
        .SYNOPSIS
            Retrieves version of SharePoint (2010 or 2013) from the associated installation configuration file

        .DESCRIPTION
            Part of the SharePoint Total Automation Toolkit (STAT). This function reads in a single data row from installation configuration file . It then reads in the values from the CSV, and returns the value of the SharePoint Version (2010 or 2013).
            
            If the configuration files are stored in the standard path and structure, you have the option of specifying each discrete parameter. Alternatively you can provide the full path to the configuration directory.
 
        .EXAMPLE
            Get-StatSharePointVersion -Company Contoso -Project Intranet -Release 1.0.0.0 -Environment Development

            If using the default configuration file path and structure, you can provide discrete parameters to each subdirectory.

        .EXAMPLE
            Get-StatSharePointVersion -ConfigPath 'C:\ProgramData\SharePoint Total Automation Toolkit\Configuration Files\Contoso\Intranet\1.0.0.0\Development'

            Using the -ConfiPath parameter allows you to directly specify the full path to the configuration files that control the process.

        .EXAMPLE
            $myFullPath | Get-StatSharePointVersion

            This function accepts pipeline input for the -ConfiPath parameter which allows you to directly specify the full path to the configuration files that control the process.

        .PARAMETER Company
            The company subdirectory (e.g. Contoso)
            Part of the overall path to the configuration files that control the installation process

        .PARAMETER Project
            The project subdirectory (e.g. Intranet)
            Part of the overall path to the configuration files that control the installation process

        .PARAMETER Release
            The release subdirectory (e.g. 1.0.0.0)
            Part of the overall path to the configuration files that control the installation process

        .PARAMETER Environment
            The target environment subdirectory (e.g. Development)
            Part of the overall path to the configuration files that control the installation process

        .PARAMETER ConfigPath
            The full path to the configuration files that control the installation process
            (e.g. 'C:\ProgramData\SharePoint Total Automation Toolkit\Configuration Files\Contoso\Intranet\1.0.0.0\Development')

        .INPUTS
            Install-SharePoint.csv

            Although not technically PowerShell "inputs", this function requires one or more comma separated value (CSV) files to be present at the configuration file path specified in the parameters or at the file path provided on the pipeline input.
            
            -------------------------- FILE 1 --------------------------

            Install-SharePoint.csv

            The associated configuration file must have a header row with the following field names:
                PathToSpInstallFiles,SharePointVersion,SharePointEdition,ProductKey,IncludeWAC,IncludeSSRS2012,TargetInstallDirectory,TargetDataDirectory
    #>
    [CmdletBinding(DefaultParametersetName="DiscreteValues")]
    param([parameter(ParameterSetName = "DiscreteValues", 
                     Mandatory = $true,
                     HelpMessage = "The company subdirectory (e.g. Contoso). Part of the overall path to the configuration files that control the installation process")]
                     [string]$Company,
	      [parameter(ParameterSetName = "DiscreteValues", 
                     Mandatory = $true,
                     HelpMessage = "The project subdirectory (e.g. Intranet). Part of the overall path to the configuration files that control the installation process")]
                     [string]$Project,
	      [parameter(ParameterSetName = "DiscreteValues", 
                     Mandatory = $true,
                     HelpMessage = "The release subdirectory (e.g. 1.0.0.0). Part of the overall path to the configuration files that control the installation process")]
                     [string]$Release,
	      [parameter(ParameterSetName = "DiscreteValues", 
                     Mandatory = $true,
                     HelpMessage = "The target environment subdirectory (e.g. Development). Part of the overall path to the configuration files that control the installation process")]
                     [string]$Environment,
	      [parameter(ParameterSetName = "FullPath", 
                     Mandatory = $true,
                     ValueFromPipeline=$true,
                     ValueFromPipelineByPropertyName=$true, 
                     HelpMessage = "The full path to the configuration files that control the installation process. (e.g. 'C:\ProgramData\SharePoint Total Automation Toolkit\Configuration Files\Contoso\Intranet\1.0.0.0\Development'")]
                     [string]$ConfigPath)

    switch ($PSCmdlet.ParameterSetName)
    {
        "DiscreteValues"
        {
            $ConfigPath = $env:ProgramData + "\SharePoint Total Automation Toolkit\Configuration Files\" + $Company + "\" + $Project + "\" + $Release + "\" + $Environment
        }    
        "FullPath"
        {
        }
    }

    # Version Compatibility Check Variable
    $firstCompatibleVersion = "0.1.0.0"

    # Conduct Version Compatibility Check
    if ((ConfigVersionIsCompatible $firstCompatibleVersion $ConfigPath))
    {
        # Setup initial paths
        $settingsFile = $ConfigPath + "\Install-SharePoint.csv"

        # Load the values from the settings file
        $settings = Import-Csv $settingsFile

        if ($settings -ne $null)
        {
            # NOTE: For this process we only expect 1 setting row in the CSV file, if there are multiple rows we will store the values
            #       from the last row and use those to continue the process
	        foreach ($settingRow in $settings)
	        {
                # Store the values from the CSV into variables
                $sharePointVersion = $settingRow.SharePointVersion
            }
        }

        return $sharePointVersion
    }
    else
    {
	    Write-Host "     ERROR:" -ForegroundColor Red
	    Write-Host "     This script requires configuration files at version" $firstCompatibleVersion "or higher." -ForegroundColor Red
	    Write-Host "     Use the Get-Help command for a complete list of the configuration files used by this script." -ForegroundColor Red

    }
}